package com.njupt.wuaiagent.rag;

import org.springframework.ai.document.Document;
import org.springframework.ai.transformer.splitter.TokenTextSplitter;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author: wujiaming
 * @CreateTime: 2025/5/18 22:20
 * @Description:
 * @Version: 1.0
 */


@Component
public class MyTokenTextSplitter {

    public List<Document> splitDocument(List<Document> documents){
        TokenTextSplitter splitter = new TokenTextSplitter();
        return splitter.apply(documents);

    }

    public List<Document> splitCustomized(List<Document> documents) {
        TokenTextSplitter splitter = new TokenTextSplitter(1000, 400, 10, 5000, true);
        return splitter.apply(documents);
    }


}
